<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>菜单管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<style type="text/css">.table td i{margin:0 2px;}</style>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#treeTable").treeTable({expandLevel : 3});
		});
    	function updateSort() {
			loading('正在提交，请稍等...');
	    	$("#listForm").attr("action", "${ctx}/sys/resource/updateSort");
	    	$("#listForm").submit();
    	}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/resource/">菜单列表</a></li>
 		<shiro:hasPermission name="/sys/resource/save"><li><a href="${ctx}/sys/resource/form?action=save">菜单添加</a></li></shiro:hasPermission> 
	</ul>
	<tags:message content="${message}"/>
	<form id="listForm" method="post">
		<table id="treeTable" class="table table-striped table-bordered table-condensed">
			<tr><th>名称</th>
			<th>链接</th>
			<th style="text-align:center;">排序</th>
			<th>可见</th>
			<th>权限标识</th>
<%--  			<shiro:hasPermission name="/sys/resource/save"> --%>
			<th>操作</th>
<%--  			</shiro:hasPermission> --%>
 			</tr>
			<c:forEach items="${list}" var="sysResource">
				<tr id="${sysResource.id}" pId="${sysResource.parentId ne '1' ? sysResource.parentId : '0'}">
					<td><i class="icon-${not empty sysResource.icon?sysResource.icon:' hide'}"></i><a href="${ctx}/sys/resource/form?id=${sysResource.id}">${sysResource.name}</a></td>
					<td>${sysResource.href}</td>
					<td style="text-align:center;">
<%-- 						<shiro:hasPermission name="/sys/resource/save"> --%>
							<input type="hidden" name="ids" value="${sysResource.id}"/>
							<input name="sorts" type="text" value="${sysResource.sort}" style="width:50px;margin:0;padding:0;text-align:center;">
							${sysResource.sort}
<%-- 						</shiro:lacksPermission> --%>
					</td>
					<td>${sysResource.isShow eq '1'?'显示':'隐藏'}</td>
					<td>${sysResource.permission}</td>
<%-- 					<shiro:hasPermission name="/sys/resource/save"> --%>
					<td>
						<a href="${ctx}/sys/resource/form?id=${sysResource.id}&action=update">修改</a>
						<a href="${ctx}/sys/resource/delete?id=${sysResource.id}" onclick="return confirmx('要删除该菜单及所有子菜单项吗？', this.href)">删除</a>
						<a href="${ctx}/sys/resource/form?parentId=${sysResource.id}&action=child">添加下级菜单</a> 
					</td>
<%-- 					</shiro:hasPermission>  --%>
				</tr>
			</c:forEach>
		</table>
<%-- 		<shiro:hasPermission name="/sys/resource/save"> --%>
		<div class="form-actions pagination-left">
			<input id="btnSubmit" class="btn btn-primary" type="button" value="保存排序" onclick="updateSort();"/>
		</div>
<%-- 		</shiro:hasPermission> --%>
	 </form>
</body>
</html>
